Skip to content

[Backport] Fix disappearing navigation arrows in fotorama zoom #18595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2018

Conversation

luukschakenraad
Copy link
Contributor

@luukschakenraad luukschakenraad commented Oct 13, 2018

Description (*)

Fix for dissapearing navigation arrows in Fotorama zoom

Fixed Issues (if relevant)

#18585: Navigation arrows zoomed fotorama disappear

Manual testing scenarios (*)

  1. Go to category Women -> Tops -> Jackets
  2. Open product "Olivia 1/4 Zip Light Jacket"
  3. Click on the large product image on the left
  4. Check that navigation arrows are visible
  5. Click on a thumbnail
  6. Check that navigation arrows keep visible

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

Original PR

#18590

@magento-engcom-team
Copy link
Contributor

Hi @luukschakenraad. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me $VERSION instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@hostep
Copy link
Contributor

hostep commented Oct 13, 2018

I might be wrong about this, but it could be that this is trying to fix the same issue as #18443 is trying to fix (but that one is for a lot more options of fotorama)

@luukschakenraad
Copy link
Contributor Author

I might be wrong about this, but it could be that this is trying to fix the same issue as #18443 is trying to fix (but that one is for a lot more options of fotorama)

That one seems to be unrelated to this issue. This one has nothing to do with any settings. It's just a bug in Fotorama which causes wrong behaviour of the previous and next buttons.

@hostep
Copy link
Contributor

hostep commented Oct 14, 2018

Well, actually they are related :)

I just played around a bit with this, if I take a clean Magento 2.2.6 installation, then apply the changes from:

And then re-test, all the issues you mention in #18585 are fixed.

Here's why, these are the configuration values outputted in the html for the fotorama library:

Vanilla 2.2.6:

{
    "fullscreen": {
        "arrows": 1,
        "loop": 1,
        "nav": "thumbs",
        "navdir": "horizontal",
        "navtype": "slides",
        "transition": "slide",
        "transitionduration": 500
    },
    "options": {
        "allowfullscreen": 1,
        "arrows": 1,
        "height": 560,
        "keyboard": 1,
        "loop": 1,
        "nav": "thumbs",
        "navarrows": 1,
        "navdir": "horizontal",
        "navtype": "slides",
        "thumbheight": 110,
        "thumbwidth": "88",
        "transition": "slide",
        "transitionduration": 500,
        "width": "700"
    }
}

After applying two fixes mentioned above:

{
    "fullscreen": {
        "arrows": true,
        "loop": true,
        "nav": "thumbs",
        "navarrows": false,
        "navdir": "horizontal",
        "navtype": "slides",
        "showCaption": false,
        "transition": "slide",
        "transitionduration": 500
    },
    "options": {
        "allowfullscreen": true,
        "arrows": true,
        "height": 560,
        "keyboard": true,
        "loop": true,
        "nav": "thumbs",
        "navarrows": true,
        "navdir": "horizontal",
        "navtype": "slides",
        "showCaption": false,
        "thumbheight": 110,
        "thumbwidth": 88,
        "transition": "slide",
        "transitionduration": 500,
        "width": 700
    }
}

You'll notice that in the fixed code, a lot of values 1 changed to the more correct value true.
For some reason, if you pass on 1 to the toggle function from jQuery, it will switch on and off and on and off, don't ask me why, my javascript knowledge isn't what it used to be. You can find a demo in https://jsfiddle.net/ot0adbhv/ (click the button a couple of times to see its behavior)

I'll leave this open for now, so a community maintainer can decide what to do with it, but in my opinion there is already a proper fix for the issue in #18443.

@luukschakenraad
Copy link
Contributor Author

You are absolutely right @hostep, very well spotted. It's my double not operator that transforms the number into a boolean and in #18443 the setting is directly set as boolean.

In my opinion, both fixes can be applied as:

@hostep
Copy link
Contributor

hostep commented Oct 14, 2018

  • The !! is also in Fotorama's source-code

Ah yes, you are correct, I wasn't aware of this!

Did it little more research, so just for some extra context:

Not sure why it got removed in Magento though ...

But if we have to get it back in Magento, I suggest you also edit the fotorama.min.js file, I believe this file should be edited manually, I don't think there is some automatic process to generate the minified version.

@luukschakenraad
Copy link
Contributor Author

I now changed the minified version as well. I did the same for pull request #18590

@sidolov sidolov changed the title Fix disappearing navigation arrows in fotorama zoom [Backport] Fix disappearing navigation arrows in fotorama zoom Oct 16, 2018
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-3200 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

Hi @luukschakenraad. Thank you for your contribution.
We will aim to release these changes as part of 2.2.8.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants